@model SampleWebsite.Mvc3.Areas.MvcMembership.Models.UserAdministration.RoleViewModel
@{
    ViewBag.Title = "Role";
    Layout = "~/Views/Shared/_Layout.cshtml";
 }

 <script type="text/javascript">
     $(function () {
         $(".action").button();
     });

    
</script>

<h3>
    Role: @Model.Role - <span class="accent">Users</span></h3>
<div class="mvcMembership-roleUsers">
    @if (Model.Users.Count() > 0)
    {

        <table style="width:auto">
            <tr>
                <th>
                    User
                </th>
                <th>
                    Action
                </th>
            </tr>
            @foreach (var key in Model.Users.Keys)
            {
                var user = Model.Users[key];
                if (user == null)
                {

                <tr>
                    <td>
                        <span>@key <em>(Deleted)</em></span>
                    </td>
                    <td>
                    </td>
                </tr>
                }
                else
                {
                <tr>
                    <td>
                        @user.UserName
                        <div style="display:inline-block">@Html.ActionLink(user.UserName, "Details", new { id = user.ProviderUserKey }, new { @class = "ui-icon ui-icon-search" })</div>
                    </td>
                    <td>
                        @using (Html.BeginForm("RemoveFromRole", "UserAdministration", new { id = user.ProviderUserKey, role = Model.Role }))
                        {
                            <a href="#" onclick="$(this).closest('form').submit()" class="action" style="width:150px">Remove From</a>
                        }
                    </td>
                </tr>                
                }

            }
        </table>
    }
    else
    {

        <p>
            No users are in this role.</p>
    }
</div>
